<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::group(['middleware' => 'web'], function () {

    //前台路由
    Route::get('/login', "Home\Auth\LoginController@showLoginForm");
    Route::post('/login', "Home\Auth\LoginController@login");

    Route::get('/register', "Home\Auth\RegisterController@showRegistrationForm");
    Route::post('/register', "Home\Auth\RegisterController@register");

    Route::group(['middleware' => 'auth:home'], function () {
        Route::resource('/', 'Home\IndexController');
    });

    //后台路由
    Route::group(['prefix' => 'admin'], function () {
        Route::get('/login', "Admin\Auth\LoginController@showLoginForm");
        Route::post('/login', "Admin\Auth\LoginController@login");
        Route::group(['middleware' => 'auth:admin'], function () {
            Route::resource('/', 'Admin\IndexController');
        });
    });

});